from typing import List


def incremovableSubarrayCount(nums: List[int]) -> int:
        n = len(nums)
        return sum([isIncreasing(nums[:i] + nums[j+1:]) for i in range(n) for j in range(i, n)])

def isIncreasing(nums):
    if len(nums) == 0:
        return True
    return all(nums[i] < nums[i + 1] for i in range(len(nums) - 1))


nums = [1,2,3,4]
res = incremovableSubarrayCount(nums)
print("result:",res)


def incremovableSubarrayCount1(nums: List[int]) -> int:
    n = len(nums)
    res = 0
    l = 1
    while l<n and nums[l-1] < nums[l]:
        l += 1
    res += l + (l <n)
    for r in range(n-2,-1,-1):
        while l >0 and nums[l-1] >= nums[r+1]:
             l -= 1
        res += l + (l <= r)
        if nums[r] >= nums[r+1]:
            break 
    return res
     

nums = [1,2,3,4]
res = incremovableSubarrayCount1(nums)
print("result:",res)